package com.woniuxy.dao;

import com.woniuxy.pojo.Emp;
import com.woniuxy.provider.EmpProvider;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;
import java.util.Map;

@Mapper
public interface EmpMapper {
    @Select("SELECT * FROM emp WHERE deptno=#{deptno}")
    public List<Emp> selectEmpsByDeptno(byte deptno);
    @Results({
            @Result(property = "empno",column = "empno"),
            @Result(property = "ename",column = "ename"),
            @Result(property = "job",column = "job"),
            @Result(property = "mgr",column = "mgr"),
            @Result(property = "hiredate",column = "hiredate"),
            @Result(property = "sal",column = "sal"),
            @Result(property = "comm",column = "comm"),
            @Result(property = "dept",column = "deptno",
                    one =@One(select = "com.woniuxy.dao.DeptMapper.selectDeptByNoStep"
                            , fetchType = FetchType.LAZY))
    })
    @Select("SELECT * FROM emp")
    public List<Emp> selectEmps();
    @Results({
            @Result(property = "empno",column = "empno"),
            @Result(property = "ename",column = "ename"),
            @Result(property = "job",column = "job"),
            @Result(property = "mgr",column = "mgr"),
            @Result(property = "hiredate",column = "hiredate"),
            @Result(property = "sal",column = "sal"),
            @Result(property = "comm",column = "comm"),
            @Result(property = "dept",column = "deptno",
                    one =@One(select = "com.woniuxy.dao.DeptMapper.selectDeptByNoStep"))
    })
    @SelectProvider(type = EmpProvider.class,method ="select" )
    public List<Emp> selectEmpsByEnameAndJob(Map<String,Object> params);
}






















